package com.example.demo.config;

import com.example.demo.service.DemoService;
import com.example.demo.service.GreetingService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.*;

@Configuration
public class AppConfig {

    @Value("${app.greeting}")
    private String msg;

    @Bean
    public DemoService demoService() {
        return new DemoService();
    }

    @Bean
    public GreetingService greetingService() {
        System.out.println("Greeting message: " + msg); //Greeting message: this is a greeting message
        return new GreetingService(msg);
    }
}
